package com.hbnu.innerclass;

/**
 * 局部内部类
 *
 * @author kittychen
 * @date 2025-09-16 16:40
 */
public class InnerDemo02 {

    public InnerDemo03 method01() {

        // 局部内部类1
        class InnerClass implements InnerDemo03 {
            private String username;

            public void method01() {
                System.out.println("局部内部类1");
            }
        }

        InnerClass innerClass = new InnerClass();
        System.out.println(innerClass.username);

        return innerClass;
    }

    // 局部代码块
    {
        // 局部内部类2
        class InnerClass {
            private String username;

            public void method01() {
                System.out.println("局部内部类1");
            }
        }

        InnerClass innerClass = new InnerClass();
        System.out.println(innerClass.username);
    }
}
